TOC-Pumping Lemma
Pumping Lemma
[!abstract]+ Lemma (Pumping Lemma) If
is a regular language, then there is a positive constant such that every string of length at least can be written as satisfying the following conditions
- for each
, and .
p is the pumping length.
Instead of proving the lemma formally, let's try to understand it.
Assume
Assume
To accept
By pigeonhole principle, some states
Assuming
Then, it's trivial that
The pumping lemma is used to prove a language is not regular.
Proof language is not regular
To prove the language
- Assume that
is regular. - Construct a string
of length . - Show that no matter how
is split into , there is always an such that (contradiction).
Proof Example
[!abstract]+ Theorem
is not regular.
Proof:
Assume
If
only consists of 's, then (pump one more time) has more 's than 's. Thus, . If
only consists of 's, same as case 1. If
has both 's and 's, then 's and 's in are intersecting with each other, which is not in the form of . Thus, .
In summary,
Here are some notes.
The pumping length
But the pumping lemma is "machine independent". Thus you cannot assume the value of
The condition
The condition
The pumping lemma is only a necessary condition for regular. It is not a sufficient condition. In other words, if you cannot find a
Pumping lemma proof example
.
Answer: Not regular.
Proof:
Assume
Since prime numbers are infinite,
By the pumping lemma,
, , for all .
Here,
Now, consider the string
- Its length is
.
However,
Thus,
.
Answer: Not regular.
Proof (Sketch):
We can express
- Here,
, and are regular languages. - Regular languages are closed under set union and complement.
If
.
Answer: Regular. In fact,
Proof:
Consider
Case 0: If
, then . Case 1: If
is a prime, then . Case 2: If
is composite, then , where each is a prime and is a positive integer constant. - Next,
for all . - Thus,
.
- Next,
Thus,
Answer: Regular.
. is regular.
Answer: Not regular.
Proof (Sketch):
- Consider the string
. - Then,
.
Pumping Lemma for Context-Free Language
[!abstract]+ Lemma (Pumping Lemma for Context-Free Language) If
is a context-free language, then there is a positive constant (pumping length) such that every string of length at least can be written as satisfying the following conditions:
- For each
, , and
Assume L is context-free. Let
- Case 1
vxy
before the #
- Case 2
vxy
before the #
more 1's but less 0's